package com.store.app.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.store.app.BaseActivity;
import com.store.app.ExitApplication;
import com.store.app.LocationApplication;
import com.store.app.R;

/**
 * Created by Administrator on 2016/3/3.
 * 促销页面
 */
public class ScalePromotion_funActivity extends BaseActivity {
    private TextView title_tv;
    private RelativeLayout relativeLayout1,relativeLayout2,relativeLayout3,relativeLayout4,relativeLayout5;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ExitApplication.getInstance().addActivity(this);
        setContentView(R.layout.activity_scalepromotion_fun);
        initViews();
        initData();
        initListeners();
    }
    private void initViews() {
        title_tv= (TextView) findViewById(R.id.tvTitle);
        relativeLayout1= (RelativeLayout) findViewById(R.id.scalefun_relat1);
        relativeLayout2= (RelativeLayout) findViewById(R.id.scalefun_relat2);
        relativeLayout3= (RelativeLayout) findViewById(R.id.scalefun_relat3);
        relativeLayout4= (RelativeLayout) findViewById(R.id.scalefun_relat4);
        relativeLayout5= (RelativeLayout) findViewById(R.id.scalefun_relat5);


        if(LocationApplication.app.getDM().widthPixels<500){
            ((TextView)findViewById(R.id.coupon)).setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
            ((TextView)findViewById(R.id.deduction)).setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
            ((TextView)findViewById(R.id.one_pay)).setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
            ((TextView)findViewById(R.id.poster)).setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
            ((TextView)findViewById(R.id.below_coupon)).setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
            ((TextView)findViewById(R.id.below_deduction)).setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
            ((TextView)findViewById(R.id.below_one_pay)).setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
            ((TextView)findViewById(R.id.below_poster)).setTextSize(TypedValue.COMPLEX_UNIT_SP,12);
        }
    }
    private void initData() {
        title_tv.setText("促销");
    }
    private void initListeners() {
        findViewById(R.id.public_ll_return).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        //礼券
        relativeLayout1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2CardVoucherActivity = new Intent(ScalePromotion_funActivity.this, CouponGoSendActivity.class);
                startActivity(intent2CardVoucherActivity);
            }
        });
        relativeLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2CardVoucherActivity = new Intent(ScalePromotion_funActivity.this, CouponNewActivity.class);
                startActivity(intent2CardVoucherActivity);
            }
        });
        relativeLayout3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2CardVoucherActivity = new Intent(ScalePromotion_funActivity.this,PostersActivity.class);
                startActivity(intent2CardVoucherActivity);
            }
        });
        relativeLayout4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2CardVoucherActivity = new Intent(ScalePromotion_funActivity.this, OneYuanBuyActivity.class);
                startActivity(intent2CardVoucherActivity);

            }
        });
        relativeLayout5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2CardVoucherActivity = new Intent(ScalePromotion_funActivity.this, DeductionActivity.class);
                startActivity(intent2CardVoucherActivity);

            }
        });
    }
}
